<?php

namespace App\Enums\OpenShop\InvestmentPromotion;

class OpenShopCacheEnum
{
    private const SHOP_MANAGER_PWD = 'SHOP_MANAGER_PWD';

    private const LOCK_WAP_PAY = 'LOCK_WAP_PAY';

    private const LOCK_CREATE_CONTRACT = 'LOCK_CREATE_CONTRACT';

    private const PID_BY_ORDER_NO = 'PID_BY_ORDER_NO';

    // 店长的初始密码
    public static function getShopManagerPwd(string $mobile): string
    {
        return sprintf(self::SHOP_MANAGER_PWD . ':%s', $mobile);
    }

    /**
     * H5支付锁
     * @param int $sysType
     * @param string $orderNo
     * @return string
     */
    public static function getLockWapPay(int $sysType, string $orderNo): string
    {
        return sprintf(self::LOCK_WAP_PAY . ":%d:%s", $sysType, $orderNo);
    }

    /**
     * 生成合同单线程锁
     * @param string $orderNo
     * @return string
     */
    public static function getLockCreateContract(string $orderNo): string
    {
        return sprintf(self::LOCK_CREATE_CONTRACT . ":%s", $orderNo);
    }

    /**
     * 通过orderNo获取pid
     * @param string $orderNo
     * @return string
     */
    public static function getPidByOrderNo(string $orderNo): string
    {
        return sprintf(self::PID_BY_ORDER_NO . ':%s', $orderNo);
    }
}
